package com.example.chainsave.upload.concurrent;


import com.example.chainsave.upload.dto.FileUploadDTO;
import com.example.chainsave.upload.dto.FileUploadRequestDTO;
import com.example.chainsave.upload.strategy.context.UploadContext;
import com.example.chainsave.upload.strategy.enu.UploadModeEnum;

import java.util.concurrent.Callable;

public class FileCallable implements Callable<FileUploadDTO> {

    private UploadModeEnum mode;

    private FileUploadRequestDTO param;


    public FileCallable(UploadModeEnum mode,
                        FileUploadRequestDTO param) {

        this.mode = mode;
        this.param = param;
    }

    @Override
    public FileUploadDTO call() throws Exception {
        //在本次请求中持有用户
        FileUploadDTO fileUploadDTO = UploadContext.INSTANCE.getInstance(mode).sliceUpload(param);
        return fileUploadDTO;
    }
}
